package top.huiwow.managers;

import org.bukkit.plugin.PluginManager;
import top.huiwow.GameCore;
import top.huiwow.entity.AkaishiEntity;
import top.huiwow.items.AkaishiBaseItem;

import java.util.HashMap;
import java.util.Map;

public class ItemManager {
    private final Map<String, AkaishiBaseItem> registeredItems = new HashMap<>();

    public void registerItem(AkaishiBaseItem... i) {
        for (AkaishiBaseItem it : i) {
            GameCore.getInstance().registerEvent(it);
            registeredItems.put(it.internalName, it);
        }
    }

    public AkaishiBaseItem getItem(String internalName) {
        return registeredItems.get(internalName);
    }
    public String getInternalName(Class<? extends AkaishiBaseItem> e) {

        for (String name:registeredItems.keySet()){
            if (registeredItems.get(name).getClass().equals(e)){
                return name;
            }
        }
        return null;
    }
}
